extends "../afuleer-1/afuleer-1.gd"


func _extInit():
	._extInit()
	lv = 2             #等级的设置
	addSkill("<唯一>战斗开始时，将最靠前的敌人，与随机3个敌人捆绑，其中1人受到非特效伤害，所有被捆绑者皆受到15%的特效伤害", "命运束缚")
var p2 = 3
func _onBattleStart():
	._onBattleStart()
	var chas = getAllChas(1)
	chas.sort_custom(self, "sortByFront")
	var bindChas = []
	bindChas.append(chas.pop_front())
	chas.shuffle()
	for i in chas:
		if bindChas.size() >= p2:break
		bindChas.append(i)
	for i in bindChas:
		if i.hasBuff("b_avrora") == null:
			i.addBuff(b_avrora.new(bindChas, self))

class b_avrora:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	var bindChas = []
	var cha
	func _init(bindChas = [], cha = null):
		attInit()
		self.bindChas = bindChas
		self.cha = cha
		id = "b_avrora"
		buffName = "命运束缚"
		dispel = 2
	func _connect():
		masCha.connect("onHurt",self,"_onHurt")
	func _onHurt(atkInfo:AtkInfo):
		if atkInfo.hurtVal > 0 && not atkInfo.isMiss and not bindChas.empty() and atkInfo.atkType != sys.AtkType.EFF:
			for i in bindChas:
				if not i.isDeath:
					cha.azurHurtChara(i, atkInfo.atkVal*0.15, atkInfo.hurtType, sys.AtkType.EFF, "命运束缚")
